package com.shd.edanpei.ui.view;

import android.content.Context;
import android.view.View;
import android.widget.LinearLayout;

import com.shd.edanpei.R;
import com.shd.edanpei.base.data.RxBusCode;
import com.shd.edanpei.base.rxbus.RxBus;

/**
 * Created by mc on 2018/10/19.
 * yang-wen-wen
 */

public class HomeFootView extends LinearLayout {

    private View tvMore;
    private View nullView;

    public HomeFootView(Context context) {
        super(context);
        initView();
    }

    private void initView() {
        inflate(getContext(), R.layout.home_foot, this);
        //                Intent intent = new Intent(getContext(), MoreOrderActivity.class);
//                getContext().startActivity(intent);
        tvMore = findViewById(R.id.tv_more);
        tvMore.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
//                Intent intent = new Intent(getContext(), MoreOrderActivity.class);
//                getContext().startActivity(intent);
                RxBus.get().send(RxBusCode.TO_ShareOrderFragment);
            }
        });

        nullView = findViewById(R.id.null_view);
    }

    public void setLayout(int i){
        if (i == 1){
            tvMore.setVisibility(VISIBLE);
            nullView.setVisibility(GONE);
        } else if (i ==2){
            tvMore.setVisibility(GONE);
            nullView.setVisibility(VISIBLE);
        }
    }
}
